package com.ruoyi.busi.guide.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.web.core.BaseController;
import com.ruoyi.common.core.core.domain.R;
import com.ruoyi.busi.guide.domain.Message;
import com.ruoyi.busi.guide.service.IMessageService;

/**
 * 沟通记录Controller
 */
@RestController
@RequestMapping("/busi/guide/message")
public class MessageController extends BaseController {
    @Autowired
    private IMessageService messageService;

    /**
     * 根据导师ID获取消息列表
     */
    @GetMapping("/mentor/{mentorId}")
    public R<List<Message>> listByMentorId(@PathVariable Long mentorId) {
        return R.ok(messageService.selectByMentorId(mentorId));
    }

    /**
     * 根据发送者获取消息列表
     */
    @GetMapping("/sender/{sender}")
    public R<List<Message>> listBySender(@PathVariable String sender) {
        return R.ok(messageService.selectBySender(sender));
    }

    /**
     * 发送消息
     */
    @PostMapping
    public R<Boolean> add(@RequestBody Message message) {
        return R.ok(messageService.save(message));
    }

    /**
     * 删除消息
     */
    @DeleteMapping("/{messageIds}")
    public R<Boolean> remove(@PathVariable List<Long> messageIds) {
        return R.ok(messageService.deleteMessageByIds(messageIds));
    }
}
